﻿
@model DHQGHN.PM2.Models.DHQG.NguoiDungModel
@{
    var lstNhomDonVi = ViewBag.lstNhomDonVi;
    var lstDonVi = ViewBag.lstDonVi;
    var nhomDonViId = ViewBag.NhomDonViId;
}

@*@Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")*@

@using (Html.BeginForm("ActionSave", "NguoiDung", FormMethod.Post, new { @id = "frmNguoiDung" }))
{
    @*<div class="row">*@
        <div class="col-md-12">
            @*<fieldset id="fs1" class="fs_group1" style="border-style:hidden;">*@
                @Html.HiddenFor(m => m.NGUOI_DUNG_ID)
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-4" style="">@Html.Label("Nhóm đơn vị:")</div>
                    <div class="col-md-8"  style="margin-bottom:8px;">
                       @Html.DropDownList("NHOM_DON_VI_ID", lstNhomDonVi as List<SelectListItem>,
                            new { @class = "form-control input-sm", value = nhomDonViId })
                    </div>

                </div>
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-4" style="">
                        @Html.Label("Đơn vị:")
                        <font size="3" color="red" style="display:inline;" class="pm2-hidden">*</font>
                    </div>
                    <div class="col-md-8" style="margin-bottom:8px;">
                        @Html.DropDownList("DON_VI_ID", lstDonVi as List<SelectListItem>, new { @class = "form-control input-sm" })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.DON_VI_ID)
                        </span>
                    </div>
                </div>
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-4">
                        @Html.LabelFor(m => m.HO_VA_TEN, new { @class = "text-center", style = "" })
                        <font size="3" color="red" style="display:inline;" class="pm2-hidden">*</font>
                    </div>
                    <div class="col-md-8" style="margin-bottom:8px;">
                        @Html.TextBoxFor(m => m.HO_VA_TEN, new { @class = "form-control  ", @autofocus = "autofocus", style = "", @maxlength = 50 })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.HO_VA_TEN)
                        </span>
                    </div>
                </div>
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-4">
                        @Html.LabelFor(m => m.TAI_KHOAN, new { @class = "text-center", style = "" })
                        <font size="3" color="red" style="display:inline;" class="pm2-hidden">*</font>
                    </div>
                    <div class="col-md-8" style="margin-bottom:8px;">
                        @Html.TextBoxFor(m => m.TAI_KHOAN, new { @class = "form-control  ", @autofocus = "autofocus", style = "", @maxlength = 50 })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.TAI_KHOAN)
                        </span>
                    </div>
                </div>
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-4">
                        @Html.LabelFor(m => m.DIEN_THOAI, new { @class = "text-center", style = "" })
                    </div>
                    <div class="col-md-8" style="margin-bottom:8px;">
                        @Html.TextBoxFor(m => m.DIEN_THOAI, new { @class = "form-control  ", @autofocus = "autofocus", style = "", @maxlength = 50 })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.DIEN_THOAI)
                        </span>
                    </div>
                </div>
            @*</fieldset>*@
        </div>
    @*</div>*@
}

@*@Scripts.Render("~/bundles/jqueryval")*@

<script>
    $(document).ready(function () {
        $("#NHOM_DON_VI_ID").val(@ViewBag.NhomDonViId);
    });
    $('#NHOM_DON_VI_ID').change(function () {
        var nhomid = $('#NHOM_DON_VI_ID').val();        
        $.ajax({
            dataType: "json",
            type: "POST",
            url: '/NguoiDung/GetDonViByNhom',
            contentType: "application/json",
            data: JSON.stringify({ strNhomDonViID: nhomid }),
            success: function (data) {
                var result = '';
                for (var i = 0; i < data.length; i++) {
                    result += '<option value="' + data[i].Value + '">' + data[i].Text + '</option>';
                }
                $("#DON_VI_ID").html(result);
                //OnCriteria(0);
            }
        });
    });

    
    //function save() {
    //    var result = false;
       
    //    return result;
    //}
</script>

